// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   ImageElement.java

package app;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import ui.Element;

public class ImageHypElement extends Element
{
    public String url;
    public String param1;
    public String param2;

    /*
    public ImageElement(String img, int x, int y, int w, int h)
    {
        super(x, y);
        image = null;
        super.width = w;
        try
        {
            image = Image.createImage("/images/" + img);
            super.left = Math.abs(image.getWidth() - super.width) >> 1;
        }
        catch(Exception e)
        {
            e.printStackTrace();
            super.left = super.width >> 1;
        }
        super.height = h;
    }
     */
    ImageHypElement(String img, int x, int y, String url) {
        super(x, y);
        super.selectable = true;
        super.clickable = true;
        this.url = url;
        image = null;
        try
        {
            image = Image.createImage("/images/" + img);
            super.left = Math.abs(image.getWidth() - super.width) >> 1;
            super.width = image.getWidth();
            super.height = image.getHeight();
        }
        catch(Exception e)
        {
            e.printStackTrace();
            super.left = super.width >> 1;
        }
    }

    public void draw(Graphics g, int x, int y, int startY, int stopY, boolean selected)
    {
        if(image != null)
        {
            g.drawImage(image, x, super.top + y, Graphics.TOP|Graphics.LEFT);

            if(selected) {
                g.setColor(0xffffff);
                g.drawRect(x-2, (super.top + y) - 2, super.width+2, super.height+2);
            }
        } else
        {
            g.setColor(0xffffff);
            g.drawRect(x-2, (super.top + y) - 2, super.width+2, super.height+2);
        }
    }

    public void setImage(Image img)
    {
        image = img;
    }

    private Image image;
}
